package com.sxbang.friday.dao;


import com.sxbang.friday.model.SysRole;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface RoleDao {
    @Insert("insert into sys_role values(#{id},#{name},#{description},#{createTime},#{updateTime})")
    int insertUser(SysRole sysRole);
    @Delete("delete from sys_role where id ='#{id}';")
    int deleteUser(int id);
    @Select("select * from sys_role")
    List<SysRole> selectUser();
//    @Select("select * from sys_role where username =#{name}")
//    SysRole getUser(String name);

    @Select("select * from sys_role t")
    List<SysRole> getAllRoles();
    @Select("select count(*) from sys_role")
    Long countAllUsers();
    @Select("select * from sys_role t order by t.id limit #{startPosition},#{limit}")
    List<SysRole> selectRole(@Param("startPosition") Integer startPosition, @Param("limit") Integer limit);
    @Select("select count(*) from sys_role t where t.name like '%${name}%'")
    Long getUserByFuzzyUsername(@Param("name") String name);
    @Select("select * from sys_role t where t.name like '%${name}%' limit #{startPosition},#{limit}")
    List<SysRole> getUserByFuzzyUsernameByPage(@Param("name")String name, @Param("startPosition") Integer startPosition, @Param("limit") Integer limit);
}
